import { defineConfig } from 'umi';


export default defineConfig({
  chunks: ['vendors', 'umi'],
  chainWebpack: function (config, { webpack }) {
    config.merge({
      optimization: {
        minimize: true,
        splitChunks: {
          chunks: 'all',
          minSize: 1024,
          minChunks: 2,
          automaticNameDelimiter: '.',
          cacheGroups: {
            antd: {
              name: "antd",
              test: /[\\/]node_modules[\\/]antd[\\/]/,
              chunks: "all",
              priority: 8
            },
            umi: {
              name: "umi",
              test: /[\\/]node_modules[\\/]umi[\\/]/,
              chunks: "all",
              priority: 8
            },
            vendor: {
              name: 'vendors',
              test({ resource }) {
                return /[\\/]node_modules[\\/]/.test(resource);
              },
              chunks: "all",
              priority: 10,
            },
          },
        },
      }
    });
  }
});
